// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../Components"

AndroidItem {
    id: _root

    signal clicked(int key)

    //上側のグラデーション
    Rectangle{
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.right: parent.right
        height: 100 * viewScale
        gradient: Gradient {
             GradientStop { position: 0.0; color: "#33000000" }
             GradientStop { position: 1.0; color: "#00000000" }
        }
    }
    //下側のグラデーション
    Rectangle{
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        height: 160 * viewScale
        gradient: Gradient {
             GradientStop { position: 0.0; color: "#00000000" }
             GradientStop { position: 1.0; color: "#88000000" }
        }
    }

    // その他ボタン
    Image{
        anchors.fill: parent
        source: "images/home_button.png"
        fillMode: Image.PreserveAspectCrop
        smooth: true
    }

    property real activeBarPosition: 0.5
    function showActiveBar(){
        if(_activeBarAnim.running === true){
            _activeBarAnim.stop();
        }
        _activeBar.opacity = 1.0;
    }
    function hideActiveBar(){
        if(_activeBarAnim.running === false){
            _activeBarAnim.start();
        }
    }
    //バー
    Image{
        x: 11 * viewScale
        y: 961 * viewScale
        width: 698 * viewScale
        height: 12 * viewScale
        source: "images/home_bar.png"
        smooth: true
        //アクティブ
        Image{
            id: _activeBar
            x: (parent.width - width) * activeBarPosition
            y: 4 * viewScale
            width: 130 * viewScale
            height: 4 * viewScale
            source: "images/home_bar_viewing.png"
            smooth: true
            opacity: 0
            onXChanged: {
//                opacity = 1.0;
            }
            NumberAnimation{
                id: _activeBarAnim
                target: _activeBar
                running: false
                property: "opacity"
                to: 0
                duration: 1000
            }
        }
    }

    //ランチャー起動ボタン
    ImageButton{
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 20 * viewScale
        width: 120 * viewScale
        height: 120 * viewScale
        imageIdle: "../Android/images/launcher_button.png"
        imagePress: "../Android/images/launcher_button_pressed.png"

        onClicked: {
            _root.clicked(1);
        }
    }
}
